<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>宿舍卫生高级查询</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
  	<link rel="stylesheet" href="css/advancedquery.css" type="text/css"></link>
  	<script type="text/javascript" src="js/ichart/ichart-1.0.min.js"></script>
  	<script type='text/javascript' src='dwr/engine.js'></script>
  	<script type='text/javascript' src='dwr/interface/GradeService.js'></script>
  	<script type='text/javascript' src='dwr/interface/HomeService.js'></script>
	<script type='text/javascript' src='dwr/interface/BuildService.js'></script>
	<script type='text/javascript' src='dwr/util.js'></script>
  	<script type="text/javascript">
  	  //获取宿舍楼号,年级数据
	  function getInfo(){
		GradeService.queryAllGname(gradecallback);
		BuildService.queryAllBno(buildscallback);
	  }
	  //queryAllGname的回调函数
	  function gradecallback(grade){
		if(grade != null){
		  //移除所有的id为gradeno下拉框的数据
		  dwr.util.removeAllOptions("gradeno");      
		  //为id为gradeno下拉框的添加数据
		  dwr.util.addOptions("gradeno", grade, "gid", "gname");	
		}
	  }
	  //queryAllBno的回调函数
	  function buildscallback(build){
		if(build != null){
		  //移除所有的id为buildno下拉框的数据
		  dwr.util.removeAllOptions("buildno");      
		  //为id为buildno下拉框的添加数据
		  dwr.util.addOptions("buildno", build, "bid", "bname");
		  //根据默认显示的楼号获取对应的宿舍号数据
		  HomeService.queryHomeByBid(dwr.util.getValue("buildno"), homescallback);		
	 	}
	  }
	  //根据楼号获取对应的宿舍号数据
      function getHome(){
		HomeService.queryHomeByBid(dwr.util.getValue("buildno"), homescallback);
	  }
      //getHome和queryHomeByBid的回调函数
	  function homescallback(home){
		if(home != null){
		  //移除所有的id为homeno下拉框的数据
		  dwr.util.removeAllOptions("homeno"); 
		  //为id为homeno下拉框的添加数据
		  dwr.util.addOptions("homeno", home, "hid", "hno");
		}
	  }
  	</script>
  </head>
  
  <body onload="getInfo()">
  	<div><div class="top">宿舍卫生图表统计查询</div></div>
    <div class="left">
      <div><a href="index.action" class="a_index">&gt;&gt;返回首页</a></div>
      <div class="title">
      	周次卫生成绩柱状图
      </div>
      <div>
      	<form action="queryByGradeAndWeek.action" target="viewport">
    	  <table>
    	    <tr>
    	      <td class="title_td">年级：</td>
    	      <td>
    	        <select id="gradeno" name="shPoint.pid" class="input_select"></select>
    	      </td>
    	    </tr>
    	  	<tr>
    	      <td class="title_td">周次：</td>
    	      <td>
    	        <select name="shPoint.week" class="input_select">
    	          <%for (int i = 1; i <= 16; i++) {%>
    	          <option value="<%=i%>">第<%=i%>周</option>
    	          <%} %>
    	        </select>
    	      </td>
    	    </tr>
    	  	<tr>
    	      <td colspan="2" class="query_td"><input type="submit" value="查询" class="input_button" /></td>
    	    </tr>
    	  </table>
    	</form>
      </div>
      <div>
      	<div class="title">
      	  宿舍卫生成绩折线图
        </div>
      	<form action="queryByHidAndBid.action" target="viewport">
    	  <table>
    	  	<tr>
    	  	  <td class="title_td">楼号：</td>
    	  	  <td>
    	  	    <select id="buildno" name="shPoint.bid" onchange="javascript:getHome();" class="input_select"></select>
    	  	  </td>
    	  	</tr>
    	  	<tr>
    	  	  <td class="title_td">宿舍号：</td>
    	  	  <td>
    	  	  	<select name="shPoint.hid" id="homeno" class="input_select"></select>
    	  	  </td>
    	  	</tr>
    	  	<tr>
    	  	  <td colspan="2" class="query_td"><input type="submit" value="查询" class="input_button" /></td>
    	  	</tr>
    	  </table>	
   	    </form>
      </div>
    </div>
    <div class="right">
      <iframe width="1000" height="500" src="" name="viewport" id="viewport" style="border:none;"> </iframe>
    </div>
  </body>
</html>
